<?php
    include "TopSdk.php";
    date_default_timezone_set('Asia/Shanghai'); 
    $c = new TopClient;
    $c->appkey = '24839886';
    $c->secretKey = '6338e7a19f2bc4be1ec57480888474cb';

//拼接授权url
//https://oauth.aliexpress.com/authorize?response_type=code&client_id=24839886&redirect_uri=http://www.ruiyuhair.cn:8089/callback/callback&state=1212&view=web&sp=ae

/*
1）获取授权码（code）
 正式环境：https://oauth.aliexpress.com/authorize
2）获取访问令牌（access_token）
 正式环境：https://oauth.aliexpress.com/token
//返回
//http://www.ruiyuhair.cn:8089/callback/callback?code=0_fGJA7GEM5MVz7xXD48g8fEUc919&state=1212
//
//换取access_token
/*curl -i -d "code=0_fGJA7GEM5MVz7xXD48g8fEUc919&grant_type=authorization_code&client_id=24839886&
client_secret=6338e7a19f2bc4be1ec57480888474cb&sp=ae&redirect_uri=http://www.ruiyuhair.cn:8089/callback/callback" https://oauth.aliexpress.com/token*/
//返回
/*{
  "access_token": "50002301008qIJraZZHy177a17a4EMsBRtdfEDrhMuxgFGSjVIy09jwDRMQYOovhTXz",
  "refresh_token": "50003300508VA6cqLESB18fad333JoqXMuahbIvGJsdvOFfeAUBsr0ckGrWADjy5JYC",
  "w1_valid": 1522808503383,
  "refresh_token_valid_time": 1522722103383,
  "w2_valid": 1522808503383,
  "user_id": "1764172453",
  "expire_time": 1522808503383,
  "r2_valid": 1522808503383,
  "locale": "zh_CN",
  "r1_valid": 1522808503383,
  "sp": "ae",
  "user_nick": "cn1501582401"
}*/
//ruiyuhair01@126.com
//ryhairrxy0323
    $req = new HttpdnsGetRequest;
    $req->putOtherTextParam("name","test");
    $req->putOtherTextParam("value",0);
//
    var_dump($c->execute($req));
?>